package com.wfk.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wfk.entity.Address;
import com.wfk.mapper.AddressMapper;
import com.wfk.service.IAddressService;
import com.wfk.utils.ValidateUtil;

/**
 * <p>
 * 全球地区库，采集自腾讯QQ国内+国际版.ADD.JENA.20141221 服务实现类
 * </p>
 *
 * @since 2019-01-07
 */
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {
	@Override
	public String getPingName(Integer proid, Integer city, Integer areaid) {
		QueryWrapper<Address> queryWrapper = new QueryWrapper<Address>();
		String address = "";
		List<Integer> ids = new ArrayList<Integer>();
		if(!ValidateUtil.objEmpty(proid)){
			ids.add(proid);
		}
		if(!ValidateUtil.objEmpty(city)){
			ids.add(city);
		}
		if(!ValidateUtil.objEmpty(areaid)){
			ids.add(areaid);
		}
		if(ids.isEmpty()){
			return "";
		}
		queryWrapper.in("id",ids);
		List<Address> list = super.list(queryWrapper);
		for(Address addr:list){
			address = address + addr.getName();
		}
		return address;
	}
}
